<?php
class DigCms_View_Helper_DigCmsItemTemplate extends Zend_View_Helper_Abstract
{
    /**
     * 
     * @param <mixed> $items
     * @param <string> $partial
     */
    public function digCmsItemTemplate($items, $partial, $module = null) {
        if(is_array($items) && count($items) > 0) {
            foreach ($items as $item) {
                $content[] = $this->_renderPartial($item, $partial, $module);
            }
            return implode(PHP_EOL, $content);
        } elseif($items instanceof DigCms_Model_Item) {
            return $this->_renderPartial($items, $partial, $module);
        }
        return false;
    }

    protected function _renderPartial(DigCms_Model_Item $item, $partial, $module) {
        return $this->view->partial($partial, $module, array('item' => $item));
    }
}
?>
